home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / mod2tutb.zip / CHARDEMO.MOD < prev    next >
Text File  |  1989-01-18  |  1KB  |  43 lines

  1.                                          (* Chapter 3 - Program 7 *)
  2. MODULE CharDemo;
  3.  
  4. FROM InOut IMPORT WriteLn, Write, WriteString;
  5.  
  6. VAR Char1, Char2, Dog3, Cat4 : CHAR;
  7.     Index                    : INTEGER;
  8.  
  9. BEGIN
  10.  
  11.    Char1 := 'A';             (* This is a capital A      *)
  12.    Char2 := "T";             (* This is a capital T      *)
  13.    Index := ORD(Char1) + 2;  (* The numerical value of A
  14.                                 plus 2 = the value of C  *)
  15.    Dog3 := CHR(Index);       (* The letter C             *)
  16.    Cat4 := '"';              (* The quotation mark       *)
  17.  
  18.    WriteString("The characters can spell ");
  19.    Write(Cat4);
  20.    Write(Dog3);
  21.    Write(Char1);
  22.    Write(Char2);
  23.    Char1 := "S";             (* Change to the letter S   *)
  24.    Write(Char1);
  25.    Write(Cat4);
  26.    WriteLn;
  27.  
  28.    Char1 := 65C;             (* This sets Char1 to 'A'   *)
  29.    Char1 := 'a';             (* This sets Char1 to 'a'   *)
  30.    Char2 := CAP(Char1);      (* This sets Char2 to 'A'   *)
  31.  
  32. END CharDemo.
  33.  
  34.  
  35.  
  36.  
  37. (* Result of execution
  38.  
  39. The characters can spell "CATS"
  40.  
  41. *)
  42.  
  43.